1. Field of the Invention
The present invention relates to a decoding apparatus. In particular, the present invention relates to a decoding apparatus that decodes data encoded in accordance with context-adaptive coding, a method of the decoding, and a program for causing a computer to execute the method.
2. Description of the Related Art
In H.264, which has been standardized by ITU-T (International Telecommunication Union-Telecommunication standardization sector), context-adaptive binary arithmetic coding (CABAC) and context-adaptive variable length coding (CAVLC) are defined as high-efficiency coding systems (see ITU-T H.264, for example). In the above coding systems, an efficient algorithm is adaptively selected in accordance with a context of a coding coefficient.
In the CABAC coding system, an encoding/decoding method is defined for each parameter forming a macroblock. This parameter is called a syntax element (SE). When the decoding is started, it is necessary to first calculate a context index (ctxIdx) corresponding to the syntax element. This context index is given by the sum of a context index offset (ctxIdxOffset), which is a value uniquely defined for each type of the syntax element, and a context index increment (ctxIdxInc), which is derived from information about adjacent macroblocks which have already been decoded.ctxIdx=ctxIdxOffset+ctxIdxInc
Here, referring to FIG. 13A, a context index increment (ctxIdxInc) for position C is given by the following equation, based on syntax elements SE_A and SE_B for a left macroblock (position A) and an upper macroblock (position B) already decoded, respectively, and a conditional flag generation function CondTerm(SE), which is defined for each type of the syntax element:ctxIdxInc=CondTerm(SE—A)+CondTerm(SE—B)
Note that the following equation, where a weight for the upper macroblock is doubled, is applied in some cases:ctxIdxInc=CondTerm(SE—A)+2×CondTerm(SE—B)However, a description of such cases will be omitted below, because application of the above equation does not make an essential difference.
Depending on where a macroblock in question is located within a frame, one or more of the adjacent macroblocks may be absent (NA: Not Available). In such cases, a value unique to each syntax element, CondTerm_NA, is used (FIGS. 13B, 13C, and 13D).ctxIdxInc=CondTerm(SE—A)+CondTerm_NActxIdxInc=CondTerm_NA+CondTerm(SE—B)ctxIdxInc=CondTerm_NA+CondTerm_NA
Similarly, in the case of the CAVLC coding system, when a quantized DCT (Discrete Cosine Transform) coefficient is decoded, an average of the number of DCT coefficients quantized for the left macroblock (position A) and the number of DCT coefficients quantized for the upper macroblock (position B) is used when selecting a variable length coding (VLC) table that is used for the decoding of position C. In other words, in the case of the CAVLC coding system, as well as in the case of the CABAC coding system, reference to the information about the left macroblock and the upper macroblock occur frequently.